package com.csu.tour.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csu.tour.entity.DiningEntertainment;
import com.csu.tour.mapper.DiningEntertainmentMapper;
import com.csu.tour.service.DiningEntertainmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DiningEntertainmentServiceImpl extends ServiceImpl<DiningEntertainmentMapper, DiningEntertainment> implements DiningEntertainmentService{
    @Autowired
    private DiningEntertainmentMapper diningEntertainmentMapper;
    private  QueryWrapper<DiningEntertainment> queryWrapper = new QueryWrapper<>();
    @Override
    public List<DiningEntertainment> findAll() {
        return diningEntertainmentMapper.selectList(null);
    }

    @Override
    public List<DiningEntertainment> findByFood(String food) {

        queryWrapper.like("food",food);
        return diningEntertainmentMapper.selectList(queryWrapper);
    }
}

////条件封装
//QueryWrapper<FykUser> queryWrapper = new QueryWrapper<>();
//queryWrapper.like(StringUtils.isNotBlank(user.getName()), "NAME", user.getName());
//        queryWrapper.like(user.getEnable() != null, "ENABLE", user.getEnable());
//List<FykUser> userList = userDao.selectList(queryWrapper);